package com.jinyi.wwdeng.pro;

import com.jinyi.base.mvp.BasePresenter;
import com.jinyi.base.mvp.IBaseView;

/**
 * JinYiTest
 *
 * @Author wwdeng
 * @CreateTime: 2024/4/26 14:26
 * @Annotation：
 */
public abstract class ProMvpAct<V extends IBaseView, P extends BasePresenter> extends ProAct {

    protected P presenter;

    /**
     * 初始化Presenter
     */
    public void initPresenter() {
        if (presenter == null){
            presenter = createPresenter();
            presenter.attachView((V) this);
        }
    }

    /**
     * 创建Presenter
     *
     * @return
     */
    protected abstract P createPresenter();

    @Override
    public void onRequestFinish() {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.detachView();
    }
}
